<template>
  <div>
    <Card shadow>
      <tree-table expand-key="name" :expand-type="false" :selectable="false" :columns="columns" :data="data">
        <template slot="action" slot-scope="scope">
          <Button @click="handle(scope)" type="primary">编辑</Button>
          <Button @click="handle(scope)" type="warning">删除</Button>
        </template>
      </tree-table>
    </Card>
  </div>
</template>

<script>
import {getTreeTableData} from "@/api/data";

export default {
  name: 'tree_table_page',
  data() {
    return {
      columns: [],
      data: [],
      name: '',
      state: ''
    }
  },
  methods: {
    handle(scope) {
      // console.log()
      console.log(scope)
    },
    getTableData(name, state) {
      getTreeTableData().then(res => {
        this.columns = res.data.columns
        this.data = res.data.data
        console.log(res)
      })
    },
    setName(name) {
      this.name = name
      alert(this.name)
    },
    setState(state) {
      this.state = state
    }
  },
  // mounted() {
  //   this.getTableData(name, state)
  // },

}
</script>

<style>
Button {
  margin: 5px;
}
</style>
